{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "provenance": []
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    },
    "language_info": {
      "name": "python"
    }
  },
  "cells": [
    {
      "cell_type": "markdown",
      "source": [
        "### Colab caches popular Kaggle datasets and models, eliminating download times and enabling near-instantaneous resource access. For instance, the widely used [\"The wildfire dataset\"](https://www.kaggle.com/datasets/elmadafri/the-wildfire-dataset) is cached for immediate use."
      ],
      "metadata": {
        "id": "ctQfZpuQ40gf"
      }
    },
    {
      "metadata": {
        "id": "AxqHvtz-2_1R"
      },
      "cell_type": "markdown",
      "source": [
        "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/googlecolab/colabtools/blob/main/notebooks/Colab_Kagglehub_Dataset_Caching.ipynb)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "_mDFJPBs4QCV",
        "outputId": "b350b5f3-684c-4c4c-d95b-402f3e9fa345"
      },
      "outputs": [],
      "source": [
        "# Copyright 2025 Google LLC.\n",
        "# SPDX-License-Identifier: Apache-2.0\n",
        "import kagglehub\n",
        "\n",
        "dataset_path = kagglehub.dataset_download(\"elmadafri/the-wildfire-dataset/versions/3\")\n",
        "\n",
        "print(\"The files are present at:\", dataset_path)"
      ]
    },
    {
      "cell_type": "markdown",
      "source": [
        "### Disable the cache to see how much longer it takes to download the dataset. With caching, download is nearly instant, without cache, download takes several minutes.\n",
        "\n"
      ],
      "metadata": {
        "id": "Jm2AIZiTG9BW"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "import kagglehub\n",
        "import os\n",
        "os.environ[\"DISABLE_COLAB_CACHE\"] = \"True\"\n",
        "\n",
        "dataset_path = kagglehub.dataset_download(\"elmadafri/the-wildfire-dataset/versions/3\")\n",
        "\n",
        "print(\"The files are present at:\", dataset_path)"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "FVgLeF98G8lb",
        "outputId": "b8db9aae-6d2a-4c66-da61-a49e9ce8951f"
      },
      "execution_count": null,
      "outputs": []
    }
  ]
}
